home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / commodore-users-of-norman / CUON_06_(08-1984).d64 / othello ii (.txt) < prev    next >
Commodore BASIC  |  2019-04-13  |  5KB  |  167 lines

  1. 1 PRINT"[147]"SPC(16)"REVERSAL":PRINTSPC(13)"COPYRIGHT 1978"
  2. 3 PRINTSPC(4)"COMMODORE BUSINESS MACHINES INC":FORI=1TO1000:NEXT
  3. 5 FORI=1TO39:E$=E$+" ":NEXT:FORJ=1TO39:E$=E$+"[157]":NEXT:N$="12345678"
  4. 7 D$="":FORI=1TO20:D$=D$+"":NEXT:DIMA(9,9),I4(7),J4(7):F2=3:B=-1:W=1:M$="[215] [209]"
  5. 9 FORK=0TO7:READI4(K),J4(K):NEXT:PRINT"[147]GREETINGS FROM REVERSAL
  6. 11 [141]251:[141]231:P[178]6:N$(B[170]1)[178]"BLACK":N$(W[170]1)[178]"WHITE
  7. 13 PRINT"DO YOU WANT TO PLAY THE PET[146] ? ";:GOSUB131
  8. 15 IFX$="N"THENPRINT"NO":GOTO37
  9. 17 IFX$<>"Y"THENGOSUB131:GOTO15
  10. 19 PRINT"YES":F2=3:PRINT"SHOULD I PLAY MY BEST ? ";:GOSUB131
  11. 21 IFX$="N"THENPRINT"NO[146]":GOTO27
  12. 23 IFX$<>"Y"THENGOSUB131:GOTO21
  13. 25 PRINT"YES":S2=2:S4=1:S5=-1.5
  14. 27 PRINT"BLACK ALWAYS GOES FIRST.":PRINT"DO YOU WANT BLACK OR WHITE[146] ? ";:GOSUB131
  15. 29 IFX$="B"THENPRINTN$(0):N$(2)="PET":GOTO35
  16. 31 IFX$<>"W"THENGOSUB131:GOTO29
  17. 33 PRINTN$(2):N$(0)="PET":F2=2
  18. 35 GOSUB329
  19. 37 PRINT"[147]";:GOSUB107:IFF2=2THENPRINT"OK, I AM THINKING!"
  20. 39 T1=B:T2=W:ONF2GOSUB151,181,151:GOSUB225:IFZ=1THEN43
  21. 41 BC=BC+S1+1:WC=WC-S1:N1=N1+1:GOSUB107
  22. 43 IFWC=0ORN1=64ORZ<0THEN53
  23. 45 T1=W:T2=B:ON F2GOSUB151,151,181:GOSUB225:IFZ=1THEN49
  24. 47 WC=WC+S1+1:BC=BC-S1:N1=N1+1:GOSUB107
  25. 49 IFBC=0ORN1=64ORZ<0THEN53
  26. 51 GOTO39
  27. 53 SN=SM
  28. 55 PRINTD$;E$:PRINTE$:PRINTE$:PRINTD$;E$"BLACK HAS"BC"AND WHITE[146] HAS"WC"PIECES."
  29. 57 IFBC=WCTHENPRINT"A TIE !!":GOTO77
  30. 59 PRINT"[209][215][209][215][209][215][209][215] ";:IFBC>WCTHENPRINT"BLACK";:GOTO63
  31. 61 PRINT"WHITE[146]";
  32. 63 PRINT" WINS !":CC=BC-WC:IFCC<0THENCC=-CC
  33. 65 CC=(64*CC)/N1:PRINT"THAT WAS A ";
  34. 67 IFCC<11THENPRINT"SQUEAKER !":GOTO77
  35. 69 IFCC<25THENPRINT"HOT GAME !":GOTO77
  36. 71 IFCC<39THENPRINT"FIGHT.":GOTO77
  37. 73 IFCC<53THENPRINT"WALKAWAY.":GOTO77
  38. 75 PRINT"PERFECT GAME."
  39. 77 PRINT"DO YOU WANT A REPLAY OF THE GAME? ";:GOSUB131:IFX$="N"THENPRINT"NO";:GOTO81
  40. 79 PRINT"YES";:GOSUB233:GOSUB237:GOSUB55
  41. 81 PRINTD$""E$"DO YOU WANT TO START THE GAME ? ";
  42. 83 GOSUB131:IFX$="Y"THENPRINT"YES";:GOSUB329:PRINT"[147]";:GOTO11
  43. 85 PRINT"NO";:END
  44. 87 F1=0:FORI1=-1TO1:FORJ1=-1TO1:IFA(I+I1,J+J1)=T2THEN91
  45. 89 NEXTJ1,I1:RETURN
  46. 91 F1=1:RETURN
  47. 93 S1=0:FORK=0TO7:I5=I4(K):J5=J4(K):I6=I+I5:J6=J+J5:S3=0:IFA(I6,J6)<>T2THEN105K
  48. 95 S3=S3+1:I6=I6+I5:J6=J6+J5:IFA(I6,J6)=T1THEN101
  49. 97 IFA(I6,J6)=0 THEN105
  50. 99 GOTO95
  51. 101 S1=S1+S3:IFU<>1THEN105
  52. 103 I6=I:J6=J:FORK1=0TOS3:A(I6,J6)=T1:I6=I6+I5:J6=J6+J5:NEXTK1
  53. 105 NEXTK:RETURN
  54. 107 PRINT""SPC(10)"  R E V E R S A L  [146]":X$="  [171][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][179]"
  55. 109 PRINTE$"    A   B   C   D   E   F   G   H"
  56. 111 PRINT"  [176][192][192][192][178][192][192][192][178][192][192][192][178][192][192][192][178][192][192][192][178][192][192][192][178][192][192][192][178][192][192][192][174]":FORI=1TO8:PRINTMID$(N$,I,1)" [221] ";
  57. 113 FORJ=1TO8:PRINTMID$(M$,A(I,J)+2,1)" [221] ";:NEXTJ:PRINT:IFI<>8THENPRINTX$
  58. 115 NEXTI:PRINT"  [173][192][192][192][177][192][192][192][177][192][192][192][177][192][192][192][177][192][192][192][177][192][192][192][177][192][192][192][177][192][192][192][189]":RETURN
  59. 117 I=-1:J=I:FORK=1TO2:GOSUB131:G=ASC(X$):IF47<GANDG<58THENI=G-48:GOTO123
  60. 119 IF64<GANDG<74THENJ=G-64:GOTO123
  61. 121 NEXT:RETURN
  62. 123 PRINT""X$"[146] ";:NEXT:RETURN
  63. 125 PRINTLEFT$(D$,2*(I-1)+5);SPC(4*(J-1)+4);:X$=MID$(M$,T1+2,1):FORK=1TOP
  64. 127 PRINT" [157]";:FORL=1TO200:NEXT:PRINTX$"[157]";:FORL=1TO200:NEXT:NEXT:RETURN
  65. 129 PRINTX$"[157]";:FORL=1TO200:NEXT:NEXT:RETURN             <
  66. 131 FORL=1TO10:GETA$:NEXT
  67. 133 L=0:PRINT"[166][157]";
  68. 135 L=L+1:GETX$:IFX$<>""THENRETURN
  69. 137 IFL<20THEN135
  70. 139 PRINT" [157]";
  71. 141 L=L+1:GETX$:IFX$<>""THENRETURN
  72. 143 IFL<40THEN141
  73. 145 GOTO133
  74. 147 PRINTD$""E$"BAD MOVE[146] INPUT ROW 0[146]-8[146] AND COL A[146]-H[146]":PRINTE$;
  75. 149 GOSUB251:IFF1>1THENGOSUB107
  76. 151 REM MOVE INPUT SUBROUTINE
  77. 153 PRINTD$;E$"INPUT "N$(T1+1)"'S[146] MOVE --   ";:GOSUB117
  78. 155 IFI<0ORJ<0ORI>8ORJ>8THEN147
  79. 157 IFI<>0THEN167
  80. 159 G2=S2:G4=S4:G5=S5:S2=0:S4=0:S5=0:GOSUB197:S2=G2:S4=G4:S5=G5:IFB1<0THEN163
  81. 161 PRINTD$""E$"NO FORFEIT ALLOWED. "N$(T1+1)"[146] HAS A MOVE.":GOTO177
  82. 163 IFZ=1THENZ=-Z:RETURN
  83. 165 Z=1:RETURN
  84. 167 IF A(I,J)=0THEN171
  85. 169 PRINTD$""E$"SORRY,SQUARE OCCUPIED BY "N$(A(I,J)+1):GOTO177
  86. 171 GOSUB87:IFF1=1THEN175
  87. 173 PRINTD$""E$"SORRY,NOT NEXT TO "N$(T2+1)"'S[146] PIECES":GOTO177
  88. 175 U=-1:GOSUB93:IFS1>0THEN179
  89. 176 PRINTD$""E$"SORRY,DOES NOT CONTAIN "N$(T2+1)
  90. 177 PRINTE$:GOTO153
  91. 179 GOTO193
  92. 181 GOSUB197:IFB1>0THEN191
  93. 183 IFS5=0THEN187
  94. 185 S5=0:GOTO181
  95. 187 PRINTD$""E$N$(T1+1)"[146] FORFEITS MOVE":IFZ=1THENZ=-Z:RETURN
  96. 189 Z=1:RETURN
  97. 191 I=I3:J=J3
  98. 193 PRINTD$""E$;N$(T1+1)"[146] MOVES TO "CHR$(I+48)"[146] "CHR$(J+64):GOSUB125:Z=0:U=1
  99. 195 GOSUB93:PRINTD$""E$"THAT GIVES "N$(T1+1)"[146]"S1"OF "N$(T2+1)"'S[146] PIECES":RETURN
  100. 197 B1=-1:I3=0:J3=0:FORI=1TO8:FORJ=1TO8:IFA(I,J)<>0THEN223
  101. 199 GOSUB87:IFF1=0THEN223
  102. 201 U=-1:GOSUB93:IFS1=0THEN223
  103. 203 IF(I=1)OR(I=8)THENS1=S1+S2
  104. 205 IF(J=1)OR(J=8)THENS1=S1+S2
  105. 207 IF(I=2)OR(I=7)THENS1=S1+S5
  106. 209 IF(J=2)OR(J=7)THENS1=S1+S5
  107. 211 IF(I=3)OR(I=6)THENS1=S1+S4
  108. 213 IF(J=3)OR(J=6)THENS1=S1+S4
  109. 215 IFS1<B1THEN223
  110. 217 IFS1>B1THEN221
  111. 219 IFRND(1)>0.5THEN223
  112. 221 B1=S1:I3=I:J3=J
  113. 223 NEXTJ,I:RETURN
  114. 225 L=((T1+1)*64)AND128:IFZ<>0THENL=LOR64:GOTO229
  115. 227 L=LOR((((I-1)*8)AND56)OR(J-1AND7))
  116. 229 POKESM,L:SM=SM+1:RETURN
  117. 231 BC=2:WC=BC:N1=4
  118. 233 FORI=0TO9:FORJ=0TO9:A(I,J)=0:NEXTJ,I:A(4,4)=W:A(5,5)=W:A(4,5)=B:A(5,4)=B
  119. 235 Z=0:F2=1:S2=0:S4=0:S5=0:SM=826:RETURN
  120. 237 PRINT"[147]   REPLAY"SPC(21)"REPLAY":P=3:FORD=826TOSN-1:GOSUB107:L=PEEK(D)
  121. 239 I=1+(LAND56)/8:J=1+(LAND7):T1=B:T2=W:IFLAND128THENT1=W:T2=B
  122. 241 IF(LAND64)=0THEN245
  123. 243 PRINTD$E$:PRINTE$:PRINTE$:PRINTD$""N$(T1+1)"[146] FORFEITS A MOVE":FORL=1TO2000:NEXT:GOTO247
  124. 245 GOSUB193
  125. 247 NEXT
  126. 249 GOTO107
  127. 251 F1=0:PRINT"DO YOU WANT INSTRUCTIONS ? ";:GOSUB131
  128. 253 IFX$="N"THENPRINT"NO":RETURN
  129. 255 IFX$<>"Y"THENGOSUB131:GOTO253
  130. 257 PRINT"YES":FORF1=1TO1000:NEXT
  131. 259 PRINT"[147]REVERSAL[146] IS PLAYED ON AN 8 X 8 BOARD,"
  132. 261 PRINT"ROWS NUMBERED 1[146] TO 8[146] AND COLUMNS A[146] TO H[146]"
  133. 263 PRINT"THE OBJECT OF THE GAME IS TO CAPTURE AS"
  134. 265 PRINT"MANY OF THE OPPONENT'S PIECES AS"
  135. 267 PRINT"POSSIBLE. TO CAPTURE PIECES,TRY TO"
  136. 269 PRINT"PLACE YOUR PIECE SO THAT A HORIZONTAL,"
  137. 271 PRINT"VERTICAL OR DIAGONAL LINE OF YOUR"
  138. 273 PRINT"OPPONENT'S PIECES WILL BE CONTAINED ON"
  139. 275 PRINT"BOTH SIDES BY YOUR'S."
  140. 277 PRINT"   [192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192]"
  141. 279 PRINT"      [221] [215] [221] [215] [221] [215] [221] [215] [221] [209]"
  142. 281 PRINT"   [192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192]"
  143. 283 PRINT"EXAMPLE: WHITE CONTAINS BLACK,"
  144. 285 PRINT"CAPTURING FOUR OF BLACK'S PIECES."
  145. 287 PRINT"HIT 'RETURN' TO CONTINUE"
  146. 289 PRINT"[145][145][145][145][145][145]";
  147. 291 FORL=1TO10:GETA$:NEXT
  148. 293 PRINT"[209][157]";:FORL=1TO200:NEXT
  149. 295 PRINT" [157]";:FORL=1TO200:NEXT
  150. 297 GETX$:IFX$=""THEN293
  151. 299 PRINT"[209] [221][160][209] [221] [209] [221] [209] [221] [209]"
  152. 301 PRINT"MAKE YOUR MOVE BY ENTERING:
  153. 303 [153]"      A NUMBER 1WAIT-8WAIT FOR THE ROW
  154. 305 PRINT"  AND A LETTER A[146]-H[146] FOR THE COLUMN.
  155. 307 [153]"NOTE: YOU MUST CAPTURE AT LEAST ONE
  156. 309 PRINT"PIECE PER TURN IF IT IS AT ALL
  157. 311 [153]"POSSIBLE. IF IT IS NOT POSSIBLE, YOU
  158. 313 PRINT"FORFEIT YOUR TURN BY ENTERING 0[146] A[146] FOR
  159. 315 [153]"YOUR MOVE.
  160. 317 PRINT"HIT 'RETURN' TO CONTINUE
  161. 319 [129]L[178]1[164]10:[161]A$:[130]
  162. 321 [161]X$:[139]X$[178]""[167]321
  163. 323 [153]"LOAD";:[142]
  164. 325 [142]
  165. 327 [131] 0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1
  166. 329 [129]L[178]1[164]1000:[130]:[142]
  167.